{include file="public/meat" title="订单列表"/}
{load href="__ADMIN__/css/order.css" /}
<div class="layout cx-fex-c mt-20 b-b pad-b10">
    <div class="xl11 cx-fex-l">
        <a class="button {neq name='$Request.action' value='index'}bg-blue{/neq} mr-10" href="{:url('index')}">订单速览</a>
        <a class="button {neq name='$postdb.status' value='all'}bg-blue{/neq} mr-10" href="{:url('get_list',array('status'=>'all'))}">全部预约</a>
        <a class="button {neq name='$postdb.status|default=0' value='0'}bg-blue{/neq} mr-10" href="{:url('get_list',array('status'=>'one'))}">等待分配老师</a>
        <a class="button {neq name='$postdb.status' value='1'}bg-blue{/neq} mr-10" href="{:url('get_list',array('status'=>'1'))}">等待授课</a>
        <a class="button {neq name='$postdb.status' value='2'}bg-blue{/neq} mr-10" href="{:url('get_list',array('status'=>'2'))}">授课完成</a>
        <a class="button {neq name='$postdb.status' value='3'}bg-blue{/neq} mr-10" href="{:url('get_list',array('status'=>'3'))}">申请取消课程</a>
        <a class="button {neq name='$postdb.status' value='4'}bg-blue{/neq} mr-10" href="{:url('get_list',array('status'=>'4'))}">已取消</a>
    </div>
</div>
<div class="layout cx-fex-c">
    <div class="xl11">
        <fieldset class="cx-field">
            <legend class="cx-field-legend">编辑订单</legend>
            <form class="layui-form" id="addform"  role="form" action="" method="post">
                <h3 class="t-c mb-15" style="border-bottom: 1px solid #dfdfdf;font-size: 1.6rem;color: #666;line-height: 40px;">课程详情</h3>
                <div class="cx-fex-c mb-15">
                    <div class="x3 t-r">
                        <label class="lab t-gray">预约课程</label>
                    </div>
                    <div class="xs8 xl9">
                        <label class="lab t-yellow">{$postdb.arttitle}</label>
                    </div>
                </div>
                <div class="cx-fex-c mb-15">
                    <div class="x3 t-r">
                        <label class="lab t-gray">联系人</label>
                    </div>
                    <div class="xs8 xl9">
                        <label class="lab t-yellow">{$postdb.useraddress.adduname}</label>
                    </div>
                </div>
                <div class="cx-fex-c mb-15">
                    <div class="x3 t-r">
                        <label class="lab t-gray">联系电话</label>
                    </div>
                    <div class="xs8 xl9">
                        <label class="lab t-yellow">{$postdb.useraddress.phone}</label>
                    </div>
                </div>
                <div class="cx-fex-c mb-15">
                    <div class="x3 t-r">
                        <label class="lab t-gray">联系地址</label>
                    </div>
                    <div class="xs8 xl9">
                        <label class="lab t-yellow">{$postdb.useraddress.addres}</label>
                    </div>
                </div>
                <div class="cx-fex-c mb-15">
                    <div class="x3 t-r">
                        <label class="lab t-gray">预约时间</label>
                    </div>
                    <div class="xs8 xl9">
                        <label class="lab t-yellow">{$postdb.maketime|date="Y-m-d h:i:d",###}</label>
                    </div>
                </div>
                <div class="cx-fex-c mb-15">
                    <div class="x3 t-r">
                        <label class="lab t-gray">订单状态</label>
                    </div>
                    <div class="xs8 xl9">
                        {switch name="postdb.status" }
                        {case value="0"}
                            {empty name="$postdb.foid"}
                        <label class="lab t-yellow">等待分配老师</label>
                            {else /}
                                {eq name="$postdb.paystatus" value="1"}
                        <label class="lab t-yellow">特约费 {$postdb.vipmoney} 元已支付，等待联系老师</label>
                                {else /}
                        <label class="lab t-yellow">等待支付特约费 {$postdb.vipmoney} 元</label>
                                {/eq}
                            {/empty}
                        {/case}
                        {case value="1"}
                            {eq name="$postdb.vipstatus" value="3"}
                        <label class="lab t-yellow">老师已拒单，等待重新分配老师</label>
                            {else /}
                            <label class="lab t-yellow">等待授课确认</label>
                            {/eq}
                        {/case}
                        {case value="2"}
                        <label class="lab t-yellow">课程结束</label>
                        {/case}
                        {case value="3"}
                            {empty name="$postdb.toid"}
                        <label class="lab t-yellow">申请取消</label>
                            {else /}
                                {eq name="$postdb.toidstatus" value="1"}
                                <label class="lab t-yellow">违约费 {:number_format($postdb['toidmoney'] / 100,'2')} 元已支付，等待取消预约</label>
                                {else /}
                                <label class="lab t-yellow">等待支付违约费 {:number_format($postdb['toidmoney'] / 100,'2')} 元</label>
                                {/eq}
                            {/empty}
                        {/case}
                        {case value="4"}
                        <label class="lab t-yellow">已取消</label>
                        {/case}
                        {/switch}
                    </div>
                </div>
                <div class="cx-fex-c mb-15">
                    <div class="x3 t-r">
                        <label class="lab t-gray">{in name="postdb.status" value="3,4"}取消预约原因{else /}订单留言{/in}</label>
                    </div>
                    <div class="xs8 xl9">
                        {empty name="postdb.cont"}
                        <label class="lab t-gray">暂无留言</label>
                        {else /}
                        <label class="lab t-yellow">{$postdb.cont}</label>
                        {/empty}
                    </div>
                </div>
                {empty name="$postdb.foid"}
                <h3 class="t-c mb-15" style="border-bottom: 1px solid #dfdfdf;font-size: 1.6rem;color: #666;line-height: 40px;">订单状态</h3>
                {else /}
                <h3 class="t-c mb-15 bg-red t-reverse" style="border-bottom: 1px solid #dfdfdf;font-size: 1.6rem;line-height: 40px;">本订单为特约订单</h3>
                {/empty}
                <div class="cx-fex-c mb-15">
                    <div class="x3 t-r">
                        <label class="lab t-gray">分配老师</label>
                    </div>
                    <div class="xs8 xl9">
                        <div class="x6 cx-input-tabel"><input id="solaoshi" placeholder="请输入老师姓名或手机" class="ipt" value="" type="text"><span class="button bg-yellow cx-input-fl" onclick="solaoshi(this)" data-cid="solaoshi" style="width: auto;">搜索老师</span></div>
                        <div class="layout mt-10 cx-fex-l">
                            {notempty name="$postdb.vipuid"}
                            <div class="xm3 xs3 cx-fex-c makelaoshi bor-green" style="padding: 5px;">
                                <div class="layout cx-fex-c fex-column makelaoshi-cont" style="padding:10px;">
                                    <div class="make-uicon" style="margin: 0 auto">
                                        <img class="img-responsive" src="{$postdb.vipuser.uicon}" onerror="this.src='__ADMIN__/usererror.png'">
                                    </div>
                                    <div class="cx-fex-c">
                                        <label class="lab t-yellow">{$postdb.vipuser.uname}</label>
                                    </div>
                                    <div class="cx-fex-c t-12">
                                        <label class="lab t-yellow"><span class="t-gray">手机:</span><span class="t-red">{$postdb.vipuser.uphone}</span></label>
                                    </div>
                                </div>
                            </div>
                            {/notempty}
                            <div class="xs9 solaoshi cx-fex-l"></div>
                        </div>
                        <script>
                            function solaoshi(o){
                                let d = $(o).data(),
                                    dv = $("#"+d.cid).val();
                                if(!dv.length){
                                    layer.msg("请输入老师姓名或手机");
                                    return false;
                                }
                                $.ajax({
                                    async:false,
                                    type: "post",
                                    dataType: "json",
                                    data: { k:dv,m:'6',has:'{$postdb.maketime|date="Y-m-d",###}',hat:'{$postdb.maketime|date="h:i:d",###}'},
                                    url: "/api/user_data/get_uid.html",
                                    success:function (data) {
                                        if(data != '0'){
                                            $('.solaoshi').html('');
                                            $(data).each(function () {
                                                if(this.makeres == true){
                                                    var radios = " <div class='cx-fex-c t-red' style='line-height: 32px;'>"+this.uname+"老师已安排课程</div> ";
                                                }else{
                                                    var radios = " <div class='cx-fex-c'><input type='radio' name='vipuid' value='" + this.uid + "' title='" + this.uname + "' lay-skin='primary' lay-filter='makeaid' data-cid='makelaoshi'></div> ";
                                                }
                                                $('.solaoshi').append("<div class='xm4 xs4 makelaoshi' style='padding: 5px;'><div class='layout fex-column makelaoshi-cont' style='padding:10px;'><div class='make-uicon' style='margin: 0 auto'><img class='img-responsive' src='"+this.uicon+"' onerror=\"this.src='__ADMIN__/usererror.png'\" alt=''></div> " + radios +" <div class='cx-fex-c t-12'><label class='lab'><span class='t-gray'>手机:</span><span class='t-red'>"+this.uphone+"</span></label></div></div></div>");
                                            });
                                            layui.use('form', function() {
                                                let form = layui.form;
                                                form.render();
                                            });
                                        }
                                        if(data.length<1){
                                            $('.solaoshi').html("<div class='t-red t-14'>没有找到您要找的老师</div>");
                                        }
                                    }
                                })
                            }
                        </script>
                    </div>
                </div>
                <div class="cx-fex-c mb-15">
                    <div class="x3 t-r">
                        <label class="lab t-gray">老师状态</label>
                    </div>
                    <div class="xs8 xl9">
                        {empty name="postdb.vipuid"}
                        <label class="lab t-yellow">等待分配老师</label>
                        {else/}
                        {switch name="postdb.vipstatus" }
                        {case value="0"}
                        <label class="lab t-yellow">等待老师接单</label>
                        {/case}
                        {case value="1"}
                        <label class="lab t-yellow">老师已确认</label>
                        {/case}
                        {case value="2"}
                        <label class="lab t-yellow">授课完毕</label>
                        {/case}
                        {case value="3"}
                        <label class="lab t-yellow">老师已拒单，请重新分配老师</label>
                        {/case}
                        {/switch}
                        {/empty}
                    </div>
                </div>
                <div class="cx-fex-c mb-15">
                    <div class="x3 t-r">
                        <label class="lab t-gray">短信通知</label>
                    </div>
                    <div class="xs8 xl9">
                        <input type="checkbox" name="sms[laoshi]" value="1" title="短信通知老师" >
                        <input type="checkbox" name="sms[xuanyue]" value="1" title="短信通知学员" >
                    </div>
                </div>
                <div class="cx-fex-c mb-15">
                    <div class="x3 t-r">
                        <label class="lab t-gray"></label>
                    </div>
                    <div class="xs8 xl9">
                        <input type="hidden" name="id" value="{$postdb.id}" class="int" required lay-verify="required|number">
                        {switch name="postdb.status" }
                        {case value="0"}
                        <input type="hidden" name="class" value="1" class="int" required lay-verify="required|number">
                        <button class="button bg-blue" lay-submit lay-filter="*">分配老师</button>
                        {/case}
                        {case value="1"}
                            {eq name="$postdb.vipstatus" value="3"}
                            <input type="hidden" name="class" value="1" class="int" required lay-verify="required|number">
                            <button class="button bg-blue" lay-submit lay-filter="*">老师已拒单，等待重新分配老师</button>
                            {else /}
                            <span class="button bg-blue">等待授课确认</span>
                            {/eq}
                        {/case}
                        {case value="2"}
                        <span class="button bg-blue">课程结束</span>
                        {/case}
                        {case value="3"}
                            <input type="hidden" name="status" value="4" class="int" required lay-verify="required|number">
                            <input type="hidden" name="class" value="2" class="int" required lay-verify="required|number">
                            {empty name="$postdb.toid"}
                            <button class="button bg-red" lay-submit lay-filter="*">同意取消</button>
                            {else /}
                                {eq name="$postdb.toidstatus" value="1"}
                                <button class="button bg-red" lay-submit lay-filter="*">同意取消</button>
                                {else /}
                                <span class="button bg-red">等待支付违约费 {:number_format($postdb['toidmoney'] / 100,'2')} 元</span>
                                {/eq}
                            {/empty}
                        {/case}
                        {case value="4"}
                        <span class="button">已取消</span>
                        {/case}
                        {/switch}
                    </div>
                </div>
            </form>
        </fieldset>
    </div>
</div>
{include file="public/js" /}
<div class="layout mt-20 cx-fex-c">
</div>
<script>
    layui.config({
        base: '__ADMIN__/js/'
    }).use('app');
</script>
{include file="order/foot" /}
{include file="public/footer" /}